/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	NativeScriptCreators.cpp
*
*	Comments	-	See NativeScriptCreators.h
*
**************************************************************************************/
#include "../Include/NativeScriptCreators.h"
#include "../Include/FactoryNativeScript.h"
#include "../Include/Actor.h"
#include "../Include/ComponentNativeScript.h"

#include "../Include/CSCameraControlFreeRoam.h"

namespace Pulse
{
	void RegisterNativeScriptsCreateMethods( void )
	{
		FactoryNativeScript *pFactory = FactoryNativeScript::GetInstance();

		pFactory->RegisterCreator( CSCameraControlFreeRoam::GetScriptNameIDStatic(), CreateCameraControlFreeRoam );
		pFactory->RegisterDeletor( CSCameraControlFreeRoam::GetScriptNameIDStatic(), DeleteCameraControlFreeRoam );
	}

	void UnregisterNativeScriptsCreateMethods( void )
	{

	}

	void CheckNewSuccessfull( void *pNewAlloc )
	{
		if ( pNewAlloc == PSX_NULL )
		{
			PSX_PushError( "Failed to create native script." );
		}
	}

	_INativeScript * CreateCameraControlFreeRoam( ComponentNativeScript *pComponentScript )
	{
		CSCameraControlFreeRoam *pNewScript = new CSCameraControlFreeRoam( pComponentScript );

		CheckNewSuccessfull( pNewScript );

		return pNewScript;
	}

	void DeleteCameraControlFreeRoam( _INativeScript *pScript )
	{
		delete pScript;
	}


}